package com.example.myprogressbar;

import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    private ProgressBar progressBar;
    private ProgressBar progressBar2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        progressBar=findViewById(R.id.pb);
        progressBar2=findViewById(R.id.pb2);
        Button btn=findViewById(R.id.showpro);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(progressBar.getVisibility()==view.GONE){
                    progressBar.setVisibility(view.VISIBLE);
                }else{
                    progressBar.setVisibility(view.GONE);
                }
            }
        });

    }
    public void addpro(View view){
        int progress=progressBar2.getProgress();
        progress+=10;
        progressBar2.setProgress(progress);
    }
}
